/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package caintra.Sapra.ComponentsImplements;

import java.util.Locale;
import java.util.ResourceBundle;
import nextapp.echo2.app.Color;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.Font;
import nextapp.echo2.app.ImageReference;
import nextapp.echo2.app.Label;
import nextapp.echo2.app.ResourceImageReference;


/**
 *
 * @author Administrador
 */
public class LabelCaintra extends Label{

    public String path_img="caintra/Sapra/Images/";
    public ResourceBundle bundle = ResourceBundle.getBundle("caintra.Sapra.Internacional.MessageBundle",Locale.US);

    public  LabelCaintra(String image){
        ImageReference img=new ResourceImageReference(path_img+""+image);
        this.setIcon(img);
    }

    public LabelCaintra(String key,Color color){
        try {
            if(bundle.containsKey(key.trim())){
                this.setText(bundle.getString(key.trim()));
            }else{
                this.setText(key);
            }
             this.setFont(new Font(Font.TIMES_NEW_ROMAN, 1, new Extent(12)));
             this.setForeground(color);
             
        } catch (Exception e) {
            this.setText("");
        }
    }

    public void setLabel_Txt(String key){
            try {
                 if(bundle.containsKey(key.trim())){
                        this.setText(bundle.getString(key.trim()));
                 }else{
                            this.setText(key);
                       }
        } catch (Exception e) {
            this.setText("");
        }
    }
}
